<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVotesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('votes', function(Blueprint $table)
		{
			$table->increments('id');
      $table->string('title', 32);            // 用户投票项标题
      $table->string('content')->nullable();  // 内容
      $table->string('img_src')->nullable();  // 图片地址
      $table->tinyInteger('is_lock');         // 是否锁定，被锁定就不可在修改
      $table->integer('vote_count');          // 总获得投票数量

      $table->unsignedInteger('vote_project_id');     // 关联投票活动id
      $table->unsignedInteger('user_id');     // 关联用户表id
			$table->nullableTimestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::dropIfExists('votes');
	}

}
